package com.carleasoft.mps.data.prefix;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

public class PropUtils {

    private static String bootstrap_file = "application.properties";

    public static Logger log = LoggerFactory.getLogger(PropUtils.class);

    private static Map<String, String> result = new HashMap<>();

    /**
     * 根据文件名获取yml的文件内容
     *
     * @return
     */
    public static Properties getProByFileName() {
        Properties props = null;
        try {
            Resource resource = new ClassPathResource(bootstrap_file);
            props= PropertiesLoaderUtils.loadProperties(resource);
        } catch (Exception e) {
            log.error("获取配置文件信息异常", e);
        }

        return props;
    }
}
